Completed
Push — master ( 68ddcd...33fc86 )
by Ajeh
30s
created

utilities.js ➔ mergeObjs   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 2
Bugs 0 Features 0
Metric Value
cc 1
c 2
b 0
f 0
nc 1
dl 0
loc 3
rs 10
nop 0
1
// utilities
2
3
export const noop = () => {}
4
5
export const cloneObj = function (obj) {
6
    return Object.assign({}, obj)
7
}
8
9
export const mergeObjs = function () {
10
    return Object.assign(...(Object.values(arguments).map(cloneObj)))
11
}
12
13
export const clickNode = function (node) {
14
    if (document.createEvent) {
15
        let evt = document.createEvent('MouseEvents');
16
        evt.initEvent('click', true, false);
17
        node.dispatchEvent(evt);
18
    } else if (document.createEventObject) {
19
        node.fireEvent('onclick');
20
    } else if (typeof node.onclick === 'function') {
21
        node.onclick();
22
    }
23
}